<?php

namespace app\admin\service;

use app\admin\controller\Backend;
use app\admin\model\BoxBanConfig;
use app\admin\validate\BoxBanConfigValidate;

class BoxBanConfigService extends BaseService
{
    /**
     * 构造函数
     * LevelService constructor.
     */
    public function __construct()
    {
        $this->model = new BoxBanConfig();
    }

    public function getList()
    {
        $param = request()->param();
        // 查询条件
        $map = [];
        if (isset($param['time'][0]) && !empty($param['time'][0])) {
            $map[] = ['create_time', '>=', strtotime($param['time'][0])];

        }
        if (isset($param['time'][1]) && !empty($param['time'][1])) {
            $map[] = ['create_time', '<=', strtotime($param['time'][1])];
        }
        return parent::getList($map); // TODO: Change the autogenerated stub
    }
    public function edit()
    {
        $param = request()->param();
        $validate = new BoxBanConfigValidate();
        if (!$validate->check($param)) {
            return message($validate->getError(), false, null, 1);
        }
        return parent::edit($param); // TODO: Change the autogenerated stub
    }



    public function delete()
    {
        $param = request()->param();
//        $validate = new BoxBanConfigValidate();
//        if (!$validate->check($param)) {
//            return message($validate->getError(), false, null, 1);
//        }
        $data['id']=$param['id'];
        return parent::delete($data,false); // TODO: Change the autogenerated stub
    }
}